<template>
  <div>
    <el-dialog
        title="企业详情"
        :visible.sync="dialogVisible"
        width="800px"
    >
      <div v-loading="loading">
        <el-form label-width="150px" size="mini">
          <el-form-item label="企业审核状态">

            <div style="display: flex">
              <div>
                <el-tag type="success" v-if="detail.wuqStatus == '2'">审核已通过</el-tag>
                <el-tag type="info" v-if="detail.wuqStatus == '0'">企业认证待审核</el-tag>
                <el-tag type="danger" v-if="detail.wuqStatus == '1'">企业认证驳回</el-tag>
                <el-tag type="danger" v-if="detail.wuqStatus == '3'">企业已注销</el-tag>
              </div>

              <div style="margin-left:20px;" v-if="detail.wuqStatus == '0'">
                <el-button type="success" class="el-icon-circle-check" @click="saveCheckAuth">通过</el-button>
                <el-button type="danger" class="el-icon-circle-close" @click="rejected">驳回</el-button>
              </div>
            </div>
          </el-form-item>
          <el-form-item label="企业名称">
            {{ detail.wuqTitle }}
          </el-form-item>
          <el-form-item label="企业地址">
            {{ detail.wuqArea }}
          </el-form-item>

          <el-form-item label="营业执照">
            <el-image style="width: 200px" :preview-src-list="detail.wuqLicense | imgListPreFilter"
                      :src="detail.wuqLicense | imgPreFilter"></el-image>
          </el-form-item>
          <el-form-item label="LOGO">
            <el-image style="width: 200px" :preview-src-list="detail.wuqLogo | imgListPreFilter"
                      :src="detail.wuqLogo | imgPreFilter"></el-image>
          </el-form-item>


          <el-form-item label="法人">
            {{ detail.wuqName }}
          </el-form-item>
          <el-form-item label="法人联系方式">
            {{ detail.wuqPhone }}
          </el-form-item>

          <el-form-item label="法人身份证正面">
            <el-image style="width: 200px" :preview-src-list="detail.cardFront | imgListPreFilter"
                      :src="detail.cardFront | imgPreFilter"></el-image>

          </el-form-item>
          <el-form-item label="法人身份证背面">
            <el-image style="width: 200px" :preview-src-list="detail.cardBack | imgListPreFilter"
                      :src="detail.cardBack | imgPreFilter"></el-image>
          </el-form-item>
        </el-form>

      </div>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">关 闭</el-button>

  </span>
    </el-dialog>
  </div>
</template>

<script>
import Api from "../../../constants/Api";

export default {
  props: ['rowDetail'],
  data() {

    return {
      dialogVisible: false,
      loading: false,
      detail: {}
    }
  },
  methods: {
    show() {
      this.dialogVisible = !this.dialogVisible;
      if (this.dialogVisible) {
        this.loading = true;
        setTimeout(() => {
          this.detail = this.rowDetail;
          // this.detail.wuqStatus = '0'
          this.loading = false
        }, 500)
      }
    },
    rejected() {
      this.$axios({
        method: 'post',
        url: Api.handler,
        data: {
          wuqId: this.detail.wuqId,
          wuqOpinion: '驳回',
          wuqStatus: this.detail.wuqStatus
        }
      }).then(res => {
        if (res.code == 20005) {
          this.$message.success("驳回成功")
          this.dialogVisible = false
        } else {
          this.$message.error(res.msg)
        }
      }).catch(() => {
        this.$message.error(res.msg)
      })
    },

    saveCheckAuth() {
      this.$axios({
        method: 'post',
        url: Api.handler,
        data: {
          wuqId: this.detail.wuqId,
          wuqOpinion: '同意',
          wuqStatus: "2"
        }
      }).then(res => {
        if (res.code == 20005) {
          this.$message.success(res.msg)
          this.dialogVisible = false
        } else {
          this.$message.error(res.msg)
        }
      }).catch(() => {
        this.$message.error(res.msg)
      })
    },

  }
}
</script>

<style>

</style>
